package com.cndongtai.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.cndongtai.dao.BaseDao;
import com.cndongtai.dao.inter.LightCurrentRecordMapper;
import com.cndongtai.po.LightCurrentRecord;

@Repository("lightCurrentRecordDao")
public class LightCurrentRecordDao extends BaseDao implements LightCurrentRecordMapper {

	@Override
	public boolean addLightCurrent(LightCurrentRecord current) {
		SqlSession sqlSession = getSqlSession();
		try {
			LightCurrentRecordMapper operation = sqlSession.getMapper(LightCurrentRecordMapper.class);
			return operation.addLightCurrent(current);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return false;
	}

	@Override
	public List<LightCurrentRecord> queryLightCurrentList(Long userId) {
		SqlSession sqlSession = getSqlSession();
		try {
			LightCurrentRecordMapper operation = sqlSession.getMapper(LightCurrentRecordMapper.class);
			return operation.queryLightCurrentList(userId);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return null;
	}
	
}
